package com.mall.course.swimPlace.service.impl;

import java.util.List;
import com.mall.common.utils.DateUtils;
import com.mall.common.utils.SecurityUtils;
import com.mall.course.swimPlace.domain.dto.SwimPlaceDto;
import com.mall.course.swimPlace.domain.vo.SwimPlaceVo;
import com.mall.course.swimPlace.mapper.SwimPlaceMapper;
import com.mall.course.swimPlace.service.ISwimPlaceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 游泳馆Service业务层处理
 * 
 * @author mall
 * @date 2024-05-18
 */
@Service
public class SwimPlaceServiceImpl implements ISwimPlaceService
{
    @Autowired
    private SwimPlaceMapper swimPlaceMapper;

    /**
     * 查询游泳馆
     * 
     * @param id 游泳馆主键
     * @return 游泳馆
     */
    @Override
    public SwimPlaceVo selectSwimPlaceById(Long id)
    {
        return swimPlaceMapper.selectSwimPlaceById(id);
    }

    /**
     * 查询游泳馆列表
     * 
     * @param swimPlaceDto 游泳馆
     * @return 游泳馆
     */
    @Override
    public List<SwimPlaceVo> selectSwimPlaceList(SwimPlaceDto swimPlaceDto)
    {
        return swimPlaceMapper.selectSwimPlaceList(swimPlaceDto);
    }

    /**
     * 新增游泳馆
     * 
     * @param swimPlaceDto 游泳馆
     * @return 结果
     */
    @Override
    public int insertSwimPlace(SwimPlaceDto swimPlaceDto)
    {
        swimPlaceDto.setCreateTime(DateUtils.getNowDate());
        swimPlaceDto.setCreateBy(SecurityUtils.getNickName());
        swimPlaceDto.setCreateId(SecurityUtils.getUserId());
        return swimPlaceMapper.insertSwimPlace(swimPlaceDto);
    }

    /**
     * 修改游泳馆
     * 
     * @param swimPlace 游泳馆
     * @return 结果
     */
    @Override
    public int updateSwimPlace(SwimPlaceDto swimPlace)
    {
        swimPlace.setUpdateTime(DateUtils.getNowDate());
        swimPlace.setUpdateBy(SecurityUtils.getNickName());
        return swimPlaceMapper.updateSwimPlace(swimPlace);
    }

    /**
     * 批量删除游泳馆
     * 
     * @param ids 需要删除的游泳馆主键
     * @return 结果
     */
    @Override
    public int deleteSwimPlaceByIds(Long[] ids)
    {
        return swimPlaceMapper.deleteSwimPlaceByIds(ids);
    }

    /**
     * 删除游泳馆信息
     * 
     * @param id 游泳馆主键
     * @return 结果
     */
    @Override
    public int deleteSwimPlaceById(Long id)
    {
        return swimPlaceMapper.deleteSwimPlaceById(id);
    }
}
